import { isPassword, isPhone } from './validate'

export const validateUsername = (rule, value, callback) => {
  if ('' == value) {
    callback(new Error('用户名不能为空'))
  } else {
    callback()
  }
}
export const validatePassword = (rule, value, callback) => {
  if (!isPassword(value)) {
    callback(new Error('密码不能少于6位'))
  } else {
    callback()
  }
}
export const validatePhone = (rule, value, callback) => {
  if (value && !isPhone(value)) {
    callback(new Error('请输入正确的手机号'))
  } else {
    callback()
  }
}
